package com.zmc.order.controller;

import com.zmc.common.utils.R;
import com.zmc.order.application.CommentApplicationService;
import com.zmc.order.infrastructure.bean.query.GoodDetailCommentQuery;
import com.zmc.order.infrastructure.service.CommentAggregateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：zmc
 * @Date：2025/5/26 13:47
 * 聚合汇总
 */

@RestController
@RequestMapping("/comment/aggregate")
public class CommentAggregateController {

    @Autowired
    private CommentAggregateService commentAggregateService;


    /**
     * 根据spuId查询商品评论汇总信息
     * */
    @PostMapping("/info")
    public R info(@RequestBody GoodDetailCommentQuery query) {
        return R.ok(commentAggregateService.getBySpuId(query.getSpuId()));
    }
}
